package com.bw.zhuangao5___day002.Fragment.Home.Fragment1;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bw.zhuangao5___day002.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * create by ertu
 * create on 2021/9/24
 * description
 */
public class BooHomeAdpter extends BaseQuickAdapter<JavaHome.ResBean.VerticalBean, BaseViewHolder> {
    public BooHomeAdpter( @Nullable List<JavaHome.ResBean.VerticalBean> data) {
        super(R.layout.homefragment1xml, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, JavaHome.ResBean.VerticalBean verticalBean) {
        Glide.with(getContext()).load(verticalBean.getImg())
               // .placeholder(R.mipmap.shaozi1)//还没有发起网络请求,一般空白或者公司logo
               // .error(R.mipmap.shaozi2)//发起请求失败，一般撕裂
                .diskCacheStrategy(DiskCacheStrategy.NONE)//关闭磁盘
                .skipMemoryCache(true)//关闭内存
                .transform(new CenterCrop())//居中裁剪
                .into((ImageView) baseViewHolder.getView(R.id.javabanner));
    }
}
